#!/bin/bash

COMPATIBLE=$(cat /proc/device-tree/compatible)
STM32MP135="stm32mp135"
STM32MP157="stm32mp157"
STM32MP157FEV1="stm32mp157f-ev1st"
STM32MP257="stm32mp257"
STM32MP255="stm32mp255"

if [[ "$COMPATIBLE" == *"$STM32MP135"* ]]; then
  MACHINE=$STM32MP135
  DWIDTH=320
  DHEIGHT=240
  DFPS=10
  COMPUTE_ENGINE=""
  IMAGE_CLASSIFICATION_MODEL="mobilenet_v1_0.5_128_quant"
  IMAGE_CLASSIFICATION_LABEL="labels"
fi

if [[ "$COMPATIBLE" == *"$STM32MP157"* ]]; then
  if [[ "$COMPATIBLE" == *"$STM32MP157FEV1"* ]]; then
    MACHINE=$STM32MP157FEV1
    DWIDTH=320
    DHEIGHT=240
    DFPS=15
    COMPUTE_ENGINE=""
    IMAGE_CLASSIFICATION_MODEL="mobilenet_v1_0.5_128_quant"
    IMAGE_CLASSIFICATION_LABEL="labels"
  else
    MACHINE=$STM32MP157
    DWIDTH=640
    DHEIGHT=480
    DFPS=15
    COMPUTE_ENGINE=""
    IMAGE_CLASSIFICATION_MODEL="mobilenet_v1_0.5_128_quant"
    IMAGE_CLASSIFICATION_LABEL="labels"
  fi
fi

if [[ "$COMPATIBLE" == *"$STM32MP257"* ]]; then
  MACHINE=$STM32MP257
  DWIDTH=640
  DHEIGHT=480
  DFPS=30
  COMPUTE_ENGINE="--npu"
  IMAGE_CLASSIFICATION_MODEL="mobilenet_v3_large_100_224_quant"
  IMAGE_CLASSIFICATION_LABEL="labels_mobilenet_v3"
fi

if [[ "$COMPATIBLE" == *"$STM32MP255"* ]]; then
  MACHINE=$STM32MP255
  DWIDTH=640
  DHEIGHT=480
  DFPS=30
  COMPUTE_ENGINE="--npu"
  IMAGE_CLASSIFICATION_MODEL="mobilenet_v3_large_100_224_quant"
  IMAGE_CLASSIFICATION_LABEL="labels_mobilenet_v3"
fi

echo "machine used = "$MACHINE
